<template>
  <div class="box">
    <div class="box1">
      <router-link to="/memo"><span>&lt;</span></router-link>
    </div>
    <router-link to="/memo"
      ><button class="el-icon-collection" @click="setCountThe"></button
    ></router-link>
    <input type="text" v-model="ipt" placeholder="标题" class="input" />
    <input type="text" v-model="ipt1" placeholder="输入内容" class="input1" />
    <router-view></router-view>
  </div>
</template>
  
<script>
import { mapState } from "vuex";
export default {
  data() {
    return {
      num: "",
      ipt: "",
      ipt1: "",
    };
  },
  created() {
    this.num = this.$route.params.id;
    console.log(this.def[this.num].ipt);
    console.log(this.def[this.num].ipt1);
    this.ipt = this.def[this.num].ipt;
    this.ipt1 = this.def[this.num].ipt1;
  },
  methods: {
    setCountThe() {
      this.def.splice(this.num, 1);
      this.$store.commit("ssss", {
        ipt: this.ipt,
        ipt1: this.ipt1,
        yue: new Date().Format("MM"),
        day: new Date().Format("ddd"),
        shi: new Date().Format("hh:mm"),
      });
    },
  },
  computed: mapState({
    def: (state) => state.list,
  }),
};
</script>

<style scoped>
.box1 {
  width: 100%;
  height: 40px;
  line-height: 40px;
  background-color: #999;
}
.box1 span {
  float: left;
  font-size: 28px;
  margin-left: 15px;
  color: #fff;
}
.box .input {
  width: 100%;
  height: 60px;
  border: none;
  outline: none;
  border-bottom: 1px solid #999;
}
.box .input1 {
  width: 100%;
  height: 60px;
  border: none;
  outline: none;
}
.el-icon-collection {
  float: right;
  font-size: 22px;
  margin-right: 15px;
  border: none;
  background-color: #ffffff;
}
</style>
